typedef struct Node {
    int data;
    struct Node* next;
    struct Node* proir;
} DLinkList;

void Reorder(DLinkList* head) {
    if (head->next == head->proir) {
        return;
    }
    if (head->next->next->data >= head->next->data) {
        return;
    }
    DLinkList* cur = head->next;
    head = cur->next;
    cur->proir->next = cur->next;
    cur->next->proir = cur->proir;
    DLinkList* temp = head->next;
    while (temp != head->next->proir) {
        if (cur->data >= temp->data && cur->data <= temp->next->data) {
            break;
        }
    }
    cur->next = temp->next;
    cur->proir = temp;
    temp->next->proir = cur;
    temp->next = cur;
    head->proir = head->next->proir;
}